# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.NetworkServices.V1.Model.GrpcRouteRouteRule do
  @moduledoc """
  Describes how to route traffic.

  ## Attributes

  *   `action` (*type:* `GoogleApi.NetworkServices.V1.Model.GrpcRouteRouteAction.t`, *default:* `nil`) - Required. A detailed rule defining how to route traffic. This field is required.
  *   `matches` (*type:* `list(GoogleApi.NetworkServices.V1.Model.GrpcRouteRouteMatch.t)`, *default:* `nil`) - Optional. Matches define conditions used for matching the rule against incoming gRPC requests. Each match is independent, i.e. this rule will be matched if ANY one of the matches is satisfied. If no matches field is specified, this rule will unconditionally match traffic.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :action => GoogleApi.NetworkServices.V1.Model.GrpcRouteRouteAction.t() | nil,
          :matches => list(GoogleApi.NetworkServices.V1.Model.GrpcRouteRouteMatch.t()) | nil
        }

  field(:action, as: GoogleApi.NetworkServices.V1.Model.GrpcRouteRouteAction)
  field(:matches, as: GoogleApi.NetworkServices.V1.Model.GrpcRouteRouteMatch, type: :list)
end

defimpl Poison.Decoder, for: GoogleApi.NetworkServices.V1.Model.GrpcRouteRouteRule do
  def decode(value, options) do
    GoogleApi.NetworkServices.V1.Model.GrpcRouteRouteRule.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.NetworkServices.V1.Model.GrpcRouteRouteRule do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
